#include"sort.h"

void PrintArry(int* a, int n) {
	for (int i = 0; i < n - 1; i++) {
		printf("%d ", a[i]);
	}
	printf("\n");
}

void TestInsertSort() {
	int a[] = { 3,1,4,6,5,8,9,7,6,2};
	PrintArry(a, sizeof(a) / sizeof(int));
	InsertSort(a, sizeof(a) / sizeof(int));
	PrintArry(a, sizeof(a) / sizeof(int));
}

void TestShellSort() {
	int a[] = { 3,1,4,6,5,8,9,7,6,2 };
	PrintArry(a, sizeof(a) / sizeof(int));
	ShellSort(a, sizeof(a) / sizeof(int));
	PrintArry(a, sizeof(a) / sizeof(int));
}

void TestSelectSort() {
	int a[] = { 3,1,4,6,5,8,9,7,6,2 };
	PrintArry(a, sizeof(a) / sizeof(int));
	SelectSort(a, sizeof(a) / sizeof(int));
	PrintArry(a, sizeof(a) / sizeof(int));
}

void TestHeapSort() {
	int a[] = { 3,1,4,6,5,8,9,7,6,2 };
	PrintArry(a, sizeof(a) / sizeof(int));
	HeapSort(a, sizeof(a) / sizeof(int));
	PrintArry(a, sizeof(a) / sizeof(int));
}

void TestBubbleSort() {
	int a[] = { 3,1,4,6,5,8,9,7,6,2 };
	PrintArry(a, sizeof(a) / sizeof(int));
	BubbleSort(a, sizeof(a) / sizeof(int));
	PrintArry(a, sizeof(a) / sizeof(int));
}

void TestQuickSort() {
	int a[] = { 3,1,4,6,5,8,9,7,6,2 };
	PrintArry(a, sizeof(a) / sizeof(int));
	QuickSort(a, 0,sizeof(a) / sizeof(int)-1);
	PrintArry(a, sizeof(a) / sizeof(int));
}

void TestQuickSortNonR() {
	int a[] = { 3,1,4,6,5,8,9,7,6,2 };
	PrintArry(a, sizeof(a) / sizeof(int));
	QuickSortNonR(a, 0, sizeof(a) / sizeof(int) - 1);
	PrintArry(a, sizeof(a) / sizeof(int));
}

void TestMergeSort() {
	int a[] = { 3,1,4,6,5,8,9,7,6,2 };
	PrintArry(a, sizeof(a) / sizeof(int));
	MergeSort(a,  sizeof(a) / sizeof(int));
	PrintArry(a, sizeof(a) / sizeof(int));
}

void TestMergeSortNonR() {
	int a[] = { 3,1,4,6,5,8,9,7,6,2 };
	PrintArry(a, sizeof(a) / sizeof(int));
	MergeSortNonR(a, sizeof(a) / sizeof(int));
	PrintArry(a, sizeof(a) / sizeof(int));
}

void TestCountSort() {
	int a[] = { 3,1,4,6,5,8,9,7,6,2 };
	PrintArry(a, sizeof(a) / sizeof(int));
	CountSort(a, sizeof(a) / sizeof(int));
	PrintArry(a, sizeof(a) / sizeof(int));
}


int main() {

	//TestInsertSort();
	//TestShellSort();
	//TestSelectSort();
	//TestHeapSort();
	//TestQuickSort();
	//TestQuickSortNonR();
	//TestMergeSort();
	//TestMergeSortNonR();
	TestCountSort();
	return 0;
}